//
//  AudioListDetailCell.m
//  Auditory
//
//  Created by 寒竹子 on 15/6/10.
//  Copyright (c) 2015年 寒竹子. All rights reserved.
//

#define KBorder 10.0f
#define KHeadImage_W 50.0f

#import "AudioListDetailCell.h"

@implementation AudioListDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = RGB(250, 250, 250, 1.0f);
        // 演唱者头像
        _headImage = [[UIImageView alloc] init];
        _headImage.layer.masksToBounds = YES;
        _headImage.layer.cornerRadius = KHeadImage_W / 2.0f;
        [self.contentView addSubview:_headImage];
        
        // title
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = TextFont(15.0f);
        _titleLabel.textColor = RGB(80, 80, 80, 1.0f);
        [self.contentView addSubview:_titleLabel];
        
        // 专辑图片
        _channelImage = [[UIImageView alloc] init];
        [self.contentView addSubview:_channelImage];
    }
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    if (self.indexPath.row == 0) {
        // 头像
        [_headImage setImage:[UIImage imageNamed:@"headDefault"]];
        _headImage.frame = CGRectMake(KBorder * 2.0f, KBorder, KHeadImage_W, KHeadImage_W);
        
        _titleLabel.frame = CGRectMake(CGRectGetMaxX(_headImage.frame) + KBorder * 2.0f, 0, self.frame.size.width - CGRectGetMaxX(_headImage.frame) - 40.0f, self.frame.size.height);
        _titleLabel.text = @"演讲者：王舰";
    }else if (self.indexPath.row == 1) {
        // 频道
        [_channelImage setImage:[UIImage imageNamed:@"headDefault"]];
        _channelImage.frame = CGRectMake(KBorder * 2.0f, KBorder, KHeadImage_W, KHeadImage_W);
        _titleLabel.frame = CGRectMake(CGRectGetMaxX(_channelImage.frame) + KBorder * 2.0f, 0, self.frame.size.width - CGRectGetMaxX(_channelImage.frame) - 40.0f, self.frame.size.height);
        _titleLabel.text = @"频道：BOSS开讲";
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
